package com.iaiai.cobra.system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.iaiai.cobra.common.vo.ResultVo;
import com.iaiai.cobra.core.BaseController;
import com.iaiai.cobra.repository.bean.LogRequest;
import com.iaiai.cobra.repository.bean.User;
import com.iaiai.cobra.repository.bean.po.UserPo;
import com.iaiai.cobra.web.params.PageParams;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * Created with LogRequestController.
 * Package: com.iaiai.cobra.system.controller
 * Author: iaiai
 * Create Time: 2024/7/27 21:44
 * QQ: 176291935
 * Email: 176291935@qq.com
 * Description:
 */
@RestController
@RequestMapping("/log/request")
public class LogRequestController extends BaseController {

    //日志列表
    @PostMapping("/list.json")
    public ResultVo page(@RequestBody PageParams params,@RequestBody LogRequest logParams) {
        if(params==null)new PageParams();
        if(params.getPage()==null || params.getLimit()==null){
            return fail("参数异常");
        }

        Page<LogRequest> pages = serviceManager.logRequestService.queryPage(
                new Page(params.getPage(),params.getLimit()),
                params.getSearch(),
                logParams.getDuration());
        return success(pages);
    }

}
